<html>
<head><meta charset="utf-8"><title>Unstable type parameters on stable types · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unstable.20type.20parameters.20on.20stable.20types.html">Unstable type parameters on stable types</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="164986837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unstable%20type%20parameters%20on%20stable%20types/near/164986837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unstable.20type.20parameters.20on.20stable.20types.html#164986837">(May 06 2019 at 14:38)</a>:</h4>
<p>WG-Allocators would like to have unstable type parameters on stable types, e.g., <code>Box&lt;T, A = alloc::Global&gt;</code> where <code>A</code> is unstable to use. See <a href="https://github.com/rust-lang/wg-allocators/issues/2" target="_blank" title="https://github.com/rust-lang/wg-allocators/issues/2">https://github.com/rust-lang/wg-allocators/issues/2</a></p>
<p>I think it would already be very helpful for us to know whether this is something that would be feasible for a sufficiently motivated party to implement in the compiler in the near future, or whether right now, given the current implementation, trying to do this would just hit to many issues, be really really hard, etc.</p>



<a name="164986996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unstable%20type%20parameters%20on%20stable%20types/near/164986996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unstable.20type.20parameters.20on.20stable.20types.html#164986996">(May 06 2019 at 14:40)</a>:</h4>
<p>Maybe the compiler team could discuss how feasible this would be in their next meeting, and give us a heads up on how feasible they think this would be?</p>



<a name="164995547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unstable%20type%20parameters%20on%20stable%20types/near/164995547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unstable.20type.20parameters.20on.20stable.20types.html#164995547">(May 06 2019 at 16:19)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="121053">@varkor</span> (I think it should be easy as long as it's only allowed on <code>struct</code>/<code>enum</code>/<code>union</code> parameters)</p>



<a name="165006774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unstable%20type%20parameters%20on%20stable%20types/near/165006774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> varkor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unstable.20type.20parameters.20on.20stable.20types.html#165006774">(May 06 2019 at 18:34)</a>:</h4>
<p>I agree, I think this should be relatively straightforward to support</p>



<a name="165074070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unstable%20type%20parameters%20on%20stable%20types/near/165074070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> John Ericson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unstable.20type.20parameters.20on.20stable.20types.html#165074070">(May 07 2019 at 14:12)</a>:</h4>
<p>Great!! Unless I'm missing something, it's fine to use an "unstable unstable annotation" (not wait for a stabilization cycle), so this shouldn't add too much latency.</p>



<a name="165092748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unstable%20type%20parameters%20on%20stable%20types/near/165092748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unstable.20type.20parameters.20on.20stable.20types.html#165092748">(May 07 2019 at 17:34)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> the intent is to use this in the alloc crate collections and related types (e.g. Box). I think all of them are <code>struct</code>s.</p>



<a name="165096093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unstable%20type%20parameters%20on%20stable%20types/near/165096093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unstable.20type.20parameters.20on.20stable.20types.html#165096093">(May 07 2019 at 18:10)</a>:</h4>
<p>please make sure that you have tests for unstable type params and that you take various places a path can be mentioned into account</p>



<a name="165096098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unstable%20type%20parameters%20on%20stable%20types/near/165096098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unstable.20type.20parameters.20on.20stable.20types.html#165096098">(May 07 2019 at 18:10)</a>:</h4>
<p>possibly also accounting for inference</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>